function getQueryString(name) {
  	let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  	let r = window.location.search.substr(1).match(reg);
  	if (r != null) {
      	return unescape(r[2]);
  	};
  	return null;
};


//设置cookie
function setCookie(cname, cvalue, exdays) {
	if ( cvalue != "" && cvalue != null ) {
	 	var d = new Date();
	 	d.setTime(d.getTime() + (exdays*24*60*60*1000));
	 	var expires = "expires="+d.toUTCString();
	 	document.cookie = cname + "=" + cvalue + "; Path=/; " + expires;
	}else{
		console.log("cvalue is null");
	}
}

//获取cookie
function getCookie(cname) {
 	var name = cname + "=";
	//console.log(document.cookie);
 	var ca = document.cookie.split(';');
 	for(var i=0; i<ca.length; i++) {
  		var c = ca[i];
  		while (c.charAt(0)==' ') c = c.substring(1);
  		if (c.indexOf(name) != -1) return c.substring(name.length, c.length);
 	}
 	return "";
}

//删除cookie 
function delCookie(name) {
  	document.cookie = name + '=; Max-Age=-99999999;';
}

	//设置默认集群
function SetDefaultCluster(cluster_id) {
	setCookie('clusterId',cluster_id,30);
	layer.msg('设置成功', {icon: 1});
}
